﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
using System.Net;

namespace Vibz.Common.Channel
{
    public class Client
    {
        string name = "";
        public string Name { get { return name; } }
        Socket _socket = null;
        public Socket Socket
        {
            get
            {
                return _socket;
            }
        }
        public Client(Socket socket)
        {
            _socket = socket;
            name = socket.RemoteEndPoint.ToString();
        }
        public void SendMessage(string data)
        {
            Network.SendMessageToClient(Socket, data);
        }
        public void SendMessage<T>(T data)
        {
            Network.SendMessageToClient(Socket, new DataPacket<T>(data).Serialize());
            //Network.SendMessageToClient(Socket, DataPacket.Serialize(data));
        }
    }
}
